package com.example.sxt_practise.thread;

import java.util.Objects;

import static java.nio.file.FileVisitResult.TERMINATE;

/**
 * @author gaofeng
 * @date 2022年05月26日 20:02
 */
public class ThreadStateTest {
    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(() -> {
            System.out.println("thread is running...");
        }) ;
        System.out.println(thread.getState());
        thread.start();
        while (!Objects.equals(thread.getState(), TERMINATE)) {
            System.out.println(thread.getState());
            thread.sleep(1000);
            System.out.println(thread.getState());
        }
        System.out.println(thread.getState());
        Thread.sleep(1000);

        System.out.println(thread.getState());
    }
}
